//验证token
import fs from "fs"
import path from "path"
import jwt  from "jsonwebtoken"
//获取密钥
const secret = fs.readFileSync(path.join(__dirname,"./screct.txt"),"utf-8")
// 验证token的方法
export default (token) => {
	return new Promise((resolve, reject) => {
		jwt.verify(token, secret, (err, data) => {
			if (err) {
				reject(err)
			}
			resolve(data)
		})
	})
}